<?php

//session_start();
require_once("function.php");
require_once("RegularEmployee.php");
//require_once("logInController.php");


class planholderRecordController
{
	function isValidPlanholderData()
	{
		return true;
	}
	/*function redirectUser()
	{
		if(isset($_SESSION['tin']) && isset($_SESSION['pos']))
		{
			if($_SESSION['pos'] == "Manager")
			{
				header("Location: managerpage.php");
			}
			else if ($_SESSION['pos'] == "Regular")
			{
				echo "Regular";
			}
		}
		else
			echo "error";
	}*/
	
	function sendPlanholderForm($policyNumber, $firstName, $middleName, $lastName, $contactNo, $birthday, $applicationNo, $accountExecutive, $type, $term, $mode, $planValue, $effectiveDate, $dueDate, $branch)
	{
		if(self::isValidPlanholderData())
		{
			$emp = new RegularEmployee;
			$emp->addPlanholder($policyNumber, $firstName, $middleName, $lastName, $contactNo, $birthday, $applicationNo, $accountExecutive, $type, $term, $mode, $planValue, $effectiveDate, $dueDate, $branch);
			//self::redirectUser();
			echo "Plan holder successfully added!";
		}
		else
			echo "Invalid data";
	}
}

$addPlanholder = new planholderRecordController;
$policyNumber = $_REQUEST['policyNumber'];
$firstName = $_REQUEST['firstName'];
$middleName = $_REQUEST['middleName'];
$lastName = $_REQUEST['lastName'];
$contactNo = $_REQUEST['contactNo'];
$birthday = $_REQUEST['birthday'];
$applicationNo = $_REQUEST['applicationNo'];
$accountExecutive = $_REQUEST['accountExecutive'];
$type = $_REQUEST['type'];
$term = $_REQUEST['term'];
$mode = $_REQUEST['mode'];
$planValue = $_REQUEST['planValue'];
$effectiveDate = $_REQUEST['effectiveDate'];
$dueDate = $_REQUEST['dueDate'];
$branch = $_REQUEST['branch'];

$addPlanholder->sendPlanholderForm($policyNumber, $firstName, $middleName, $lastName, $contactNo, $birthday, $applicationNo, $accountExecutive, $type, $term, $mode, $planValue, $effectiveDate, $dueDate, $branch);
?>